package com.shenmazg6.controller;

import com.shenmazg6.service.TbRoomService;
import com.shenmazg6.utils.ResultResponse;
import com.shenmazg6.vo.IdVo;
import com.shenmazg6.vo.PageInfoVo;
import com.shenmazg6.vo.RoomInfoVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 军哥
 * @version 1.0
 * @description: TbRoomController
 * @date 2022/12/22 15:46
 */

@RestController
@Slf4j
@RequestMapping(value = "/room")
public class TbRoomController {

    @Autowired
    TbRoomService tbRoomService;

    @PostMapping(value = "/add")
    public ResultResponse add(@RequestBody RoomInfoVo roomInfoVo) {
        return tbRoomService.add(roomInfoVo);
    }

    @PostMapping(value = "/list")
    public ResultResponse list(@RequestBody PageInfoVo pageInfoVo) {
        return tbRoomService.listByPage(pageInfoVo);
    }

    @PostMapping(value = "/get")
    public ResultResponse get(@RequestBody IdVo idVo) {
        return tbRoomService.getRoomById(idVo);
    }
}
